package com.ouyu;

import com.ouyu.domain.UserService;
import com.ouyu.factory.config.BeanDefinition;
import com.ouyu.factory.support.DefaultListableBeanFactory;

/**
 * @Author: hz21056677
 * @Description:
 * @Date: Created in 17:24 2021/6/3
 */
public class TrySpring {
    public static void main(String[] args) {
        BeanDefinition beanDefinition = new BeanDefinition(UserService.class);
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        beanFactory.registryBeanDefinition("userService",beanDefinition);
//        UserService userservice = (UserService)beanFactory.getBean("userService");
        //有构造参数 获取实例对象
        UserService userservice = (UserService)beanFactory.getBean("userService","OO");
        userservice.sayHi();


    }
}
